#ifndef LDA_ABSTRACT_HEADER
#define LDA_ABSTRACT_HEADER
#include<string>
#include<fstream>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<iterator>
#include<vector>
#include<map>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include "def.hpp"
#include "utils.hpp"
#include "topicmodel_generic_model.hpp"

class LatentDirichletAllocation:public GenericTopicModel{
protected:
  double* alpha;
  double* beta;
  double AlphaSum;
  double BetaSum;
public:
  LatentDirichletAllocation();
  virtual void Inference()=0;
  virtual void Prediction()=0;
  virtual double Likelihood()=0;
  virtual int GetDocuments(int)=0; // this indicate how documents are read through into the model
  virtual int ReadDOCS()=0;
  virtual int SaveModel() { return 0; };
  virtual int Interactive() { return 0; };
};

LatentDirichletAllocation::LatentDirichletAllocation(){
  // allocate common arrays and initialize
  alpha = new double[PuzaDEF::Instance()->TOPIC_NUM];
  beta = new double[PuzaDEF::Instance()->TERM_NUM];
  AlphaSum = 0.0;
  for(int i=0; i < PuzaDEF::Instance()->TOPIC_NUM; i++){
    alpha[i] = PuzaDEF::Instance()->LDA_initial_alpha;
    AlphaSum += alpha[i];
  }
  BetaSum = 0.0;
  for(int i=0; i < PuzaDEF::Instance()->TERM_NUM; i++){
    beta[i] = PuzaDEF::Instance()->LDA_initial_beta;
    BetaSum += beta[i];
  }
}

#endif
